#include "mystdio.h"
#include <string.h>
#include <unistd.h>
#include <stdio.h>

int main()
{
    MYFILE *fp = my_fopen("log.txt", "a");
    if(fp == NULL)
    {
        return 1;
    }

    char data[128];
    const char *s = "hello myfile";
    int cnt = 20;
    while(cnt--)
    {
        snprintf(data, sizeof(data), "%s:%d", s, cnt);
        my_fwrite(data, strlen(data), fp);
        //sleep(1);
    }

    my_fclose(fp);

    return 0;
}